import React, { memo } from 'react'
import { Pagination } from 'antd';
import {HNPaginationWrap} from './style'
export default memo(function HNPagination(props) {
    
    const {totalSize,onChange,currentPage,pageSize} = props;
    const itemRender = (current, type, originalElement)=> {
        if (type === 'prev') {
            return (
                <div className="pre">
                    <span className="arrow-left"></span>
                    <span>上一页</span>
                </div>
            )
        }
        if (type === 'next') {
            return (
                <div className="next">
                    <span className="arrow-right"></span>
                    <span>下一页</span>
                </div>
            )
        }
        return originalElement;
    }
    return (
        <HNPaginationWrap>
            <Pagination
                size="small"    
                defaultCurrent={1}
                total={totalSize}
                itemRender={itemRender}
                onChange={onChange}
                current={currentPage}
                pageSize={pageSize-1}
                showSizeChanger={false}
            />
        </HNPaginationWrap>
    )
})
